@model SharedPageVM

@{
    ViewData["Title"] = "Discover draw";
    if (ViewData["Nickname"] != null)
    {
        ViewData["Title"] = ViewData["Nickname"] + " draw";
    }

    var uinfo = Netnr.Blog.Web.Apps.LoginService.Get(ViewContext.HttpContext);
    var rows = Model.Rows as List<Netnr.Blog.Domain.Draw>;

    string ca = ViewContext.RouteData.Values["controller"].ToString().ToLower() + "/" + ViewContext.RouteData.Values["action"].ToString().ToLower();
    string rid = ViewContext.RouteData.Values["id"]?.ToString().ToLower();
}

<div class="container-fluid">
    <div class="row">
        <div class="col-12 mt-5 mb-2">
            @if (ca == "user/index" && uinfo.UserId.ToString() == rid)
            {
                <a class="float-right" href="/draw/code/form">Add</a>
            }
            We’ve found <b>@Model.Pag.Total.ToString("N0")</b> results
        </div>
        @if (rows.Count > 0)
        {
            foreach (var item in rows)
            {
                <div class="col-xl-3 col-lg-4 col-md-6 mb-4">
                    <div class="card border-dark card-pi">
                        <div class="card-body text-dark">
                            @if (uinfo.UserId == item.Uid)
                            {
                                <span class="card-tool">
                                    <a href="/draw/code/form/@item.DrId" class="fa fa-edit" title="编辑"></a>
                                    <a href="/draw/code/del/@item.DrId" class="fa fa-trash-o text-danger" title="删除" onclick="return confirm('确定删除?')"></a>
                                    @if (item.DrOpen != 1 && !string.IsNullOrWhiteSpace(item.Spare1))
                                    {
                                        <a href="/draw/code/@(item.DrId+"/?code="+item.Spare1)" target="_blank" class="fa fa-share-alt text-success" title="分享码查看链接"></a>
                                    }
                                </span>
                            }
                            <a class="h5 card-title" href="/draw/code/@item.DrId/">
                                @if (item.DrType == "draw")
                                {
                                    <span title="绘图" class="mr-1 badge badge-light text-success">Draw</span>
                                }
                                else
                                {
                                    <span title="思维导图" class="mr-1 badge badge-light text-info">Mind</span>
                                }
                                @if (item.DrOpen != 1)
                                {
                                    <i class="fa fa-lock text-success mr-1" title="私有"></i>
                                }
                                @item.DrName
                            </a>
                            <p>
                                <i class="fa fa-user text-muted"></i>
                                <a href="/draw/user/@item.Uid">@item.Spare3</a>
                                &nbsp;
                                <span class="text-muted small">@item.DrCreateTime?.ToString("yyyy-MM-dd HH:mm")</span>
                            </p>
                            <div class="text-muted">@(string.IsNullOrWhiteSpace(item.DrRemark) ? "暂无备注" : item.DrRemark)</div>
                        </div>
                    </div>
                </div>
            }

            <div class="col-12">
                <partial name="_PartialPaging4" model="Model" />
            </div>
        }
    </div>
</div>